{* $Id: 20110317 *}
{literal}
<script type="text/javascript">
    $(function(){
        var $editors = $("textarea.with-ck");
        if ($editors.length) {
            $editors.each(function(){
                var editorID = $(this).attr("id");
                var instance = CKEDITOR.instances[editorID];
                if (instance) {
                    delete CKEDITOR.instances[editorID];
                    instance = null;
                }
                if ($(this).val() == '') {
                    $(this).val('<p>&nbsp;</p>');
                }
                $(this).ckeditor(ckconfig);
            });
        }

        $('tr.elements').quickpaginate({
            pager: $("#pager_here"),
            perpage: 30
        });
        
        $('.admin-datepicker').datePicker({startDate: _startdate});
        
		$('.admin-search-area').prev().bind('click',function(){
			$('.admin-search-area').hide();
			$(this).next().show();
			return false;
		});
		{/literal}
		{if $file_upload eq 1}
		{literal}
		$('.tk-form-file_upload-trigger').each(function(){
			var _this = $(this);
			var _target = _this.attr('title');
			var _id = _this.attr('id');

			_this.uploadify({
				'uploader': _templatePath + 'images/uploadify/uploadify.swf',
				'cancelImg': _templatePath + 'images/uploadify/cancel.png',
				'script': _root + '/file/index.html?&jx=1'+ _ajaxext,
				'folder': '/',
				'multi': false,
				'displayData': 'perc-speed',
				'removeCompleted': false,
				'auto': true,

				'buttonText': 'Dosyayi Seciniz',
				
				onSelectOnce : function(event,ID,fileObj){
					_this.uploadifySettings('scriptData',{"path":"","subpath":"","sid":"{/literal}{$user.session_id}{literal}"});
				},
				
				onComplete: function(event, ID, fileObj, response, data) {
					var json = $.parseJSON(response);
					if(json.status == 0)
					{
					/* error */
					_this.attr('value','');
						$('#'+_id+'uplStatus').html(json.message);
					}
					if(json.status == 1)
					{
					/*success*/
					_this.attr('value',json.filepath);
					$('#'+_id+'uplStatus').html(json.message);
					}
				}
			});
		});
		{/literal}							
		{/if}{literal}
});
</script>
{/literal}
